home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / AIFF.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  5.9 KB  |  259 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AIFF.h
  3.  
  4.      Contains:    Definition of AIFF file format components.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1995, 1997-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __AIFF__
  18. #define __AIFF__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23.  
  24.  
  25.  
  26. #if PRAGMA_ONCE
  27. #pragma once
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37.  
  38. #if PRAGMA_STRUCT_ALIGN
  39.     #pragma options align=mac68k
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41.     #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43.     #pragma pack(2)
  44. #endif
  45.  
  46.  
  47. enum {
  48.     AIFFID                        = FOUR_CHAR_CODE('AIFF'),
  49.     AIFCID                        = FOUR_CHAR_CODE('AIFC'),
  50.     FormatVersionID                = FOUR_CHAR_CODE('FVER'),
  51.     CommonID                    = FOUR_CHAR_CODE('COMM'),
  52.     FORMID                        = FOUR_CHAR_CODE('FORM'),
  53.     SoundDataID                    = FOUR_CHAR_CODE('SSND'),
  54.     MarkerID                    = FOUR_CHAR_CODE('MARK'),
  55.     InstrumentID                = FOUR_CHAR_CODE('INST'),
  56.     MIDIDataID                    = FOUR_CHAR_CODE('MIDI'),
  57.     AudioRecordingID            = FOUR_CHAR_CODE('AESD'),
  58.     ApplicationSpecificID        = FOUR_CHAR_CODE('APPL'),
  59.     CommentID                    = FOUR_CHAR_CODE('COMT'),
  60.     NameID                        = FOUR_CHAR_CODE('NAME'),
  61.     AuthorID                    = FOUR_CHAR_CODE('AUTH'),
  62.     CopyrightID                    = FOUR_CHAR_CODE('(c) '),
  63.     AnnotationID                = FOUR_CHAR_CODE('ANNO')
  64. };
  65.  
  66.  
  67. enum {
  68.     NoLooping                    = 0,
  69.     ForwardLooping                = 1,
  70.     ForwardBackwardLooping        = 2,                            /* AIFF-C Versions */
  71.     AIFCVersion1                = (long)0xA2805140
  72. };
  73.  
  74.  
  75.  
  76. /* Compression Names */
  77. #define NoneName "\pnot compressed"
  78. #define ACE2to1Name "\pACE 2-to-1"
  79. #define ACE8to3Name "\pACE 8-to-3"
  80. #define MACE3to1Name "\pMACE 3-to-1"
  81. #define MACE6to1Name "\pMACE 6-to-1"
  82.  
  83.  
  84. enum {
  85.                                                                 /* Compression Types */
  86.     NoneType                    = FOUR_CHAR_CODE('NONE'),
  87.     ACE2Type                    = FOUR_CHAR_CODE('ACE2'),
  88.     ACE8Type                    = FOUR_CHAR_CODE('ACE8'),
  89.     MACE3Type                    = FOUR_CHAR_CODE('MAC3'),
  90.     MACE6Type                    = FOUR_CHAR_CODE('MAC6')
  91. };
  92.  
  93. typedef unsigned long                     ID;
  94. typedef short                             MarkerIdType;
  95.  
  96. struct ChunkHeader {
  97.     ID                                 ckID;
  98.     long                             ckSize;
  99. };
  100. typedef struct ChunkHeader                ChunkHeader;
  101.  
  102. struct ContainerChunk {
  103.     ID                                 ckID;
  104.     long                             ckSize;
  105.     ID                                 formType;
  106. };
  107. typedef struct ContainerChunk            ContainerChunk;
  108.  
  109. struct FormatVersionChunk {
  110.     ID                                 ckID;
  111.     long                             ckSize;
  112.     unsigned long                     timestamp;
  113. };
  114. typedef struct FormatVersionChunk        FormatVersionChunk;
  115. typedef FormatVersionChunk *            FormatVersionChunkPtr;
  116.  
  117. struct CommonChunk {
  118.     ID                                 ckID;
  119.     long                             ckSize;
  120.     short                             numChannels;
  121.     unsigned long                     numSampleFrames;
  122.     short                             sampleSize;
  123.     extended80                         sampleRate;
  124. };
  125. typedef struct CommonChunk                CommonChunk;
  126. typedef CommonChunk *                    CommonChunkPtr;
  127.  
  128. struct ExtCommonChunk {
  129.     ID                                 ckID;
  130.     long                             ckSize;
  131.     short                             numChannels;
  132.     unsigned long                     numSampleFrames;
  133.     short                             sampleSize;
  134.     extended80                         sampleRate;
  135.     ID                                 compressionType;
  136.     char                             compressionName[1];            /* variable length array, Pascal string */
  137. };
  138. typedef struct ExtCommonChunk            ExtCommonChunk;
  139. typedef ExtCommonChunk *                ExtCommonChunkPtr;
  140.  
  141. struct SoundDataChunk {
  142.     ID                                 ckID;
  143.     long                             ckSize;
  144.     unsigned long                     offset;
  145.     unsigned long                     blockSize;
  146. };
  147. typedef struct SoundDataChunk            SoundDataChunk;
  148. typedef SoundDataChunk *                SoundDataChunkPtr;
  149.  
  150. struct Marker {
  151.     MarkerIdType                     id;
  152.     unsigned long                     position;
  153.     Str255                             markerName;
  154. };
  155. typedef struct Marker                    Marker;
  156.  
  157. struct MarkerChunk {
  158.     ID                                 ckID;
  159.     long                             ckSize;
  160.     unsigned short                     numMarkers;
  161.     Marker                             Markers[1];                    /* variable length array */
  162. };
  163. typedef struct MarkerChunk                MarkerChunk;
  164. typedef MarkerChunk *                    MarkerChunkPtr;
  165.  
  166. struct AIFFLoop {
  167.     short                             playMode;
  168.     MarkerIdType                     beginLoop;
  169.     MarkerIdType                     endLoop;
  170. };
  171. typedef struct AIFFLoop                    AIFFLoop;
  172.  
  173. struct InstrumentChunk {
  174.     ID                                 ckID;
  175.     long                             ckSize;
  176.     UInt8                             baseFrequency;
  177.     UInt8                             detune;
  178.     UInt8                             lowFrequency;
  179.     UInt8                             highFrequency;
  180.     UInt8                             lowVelocity;
  181.     UInt8                             highVelocity;
  182.     short                             gain;
  183.     AIFFLoop                         sustainLoop;
  184.     AIFFLoop                         releaseLoop;
  185. };
  186. typedef struct InstrumentChunk            InstrumentChunk;
  187. typedef InstrumentChunk *                InstrumentChunkPtr;
  188.  
  189. struct MIDIDataChunk {
  190.     ID                                 ckID;
  191.     long                             ckSize;
  192.     UInt8                             MIDIdata[1];                /* variable length array */
  193. };
  194. typedef struct MIDIDataChunk            MIDIDataChunk;
  195. typedef MIDIDataChunk *                    MIDIDataChunkPtr;
  196.  
  197. struct AudioRecordingChunk {
  198.     ID                                 ckID;
  199.     long                             ckSize;
  200.     UInt8                             AESChannelStatus[24];
  201. };
  202. typedef struct AudioRecordingChunk        AudioRecordingChunk;
  203. typedef AudioRecordingChunk *            AudioRecordingChunkPtr;
  204.  
  205. struct ApplicationSpecificChunk {
  206.     ID                                 ckID;
  207.     long                             ckSize;
  208.     OSType                             applicationSignature;
  209.     UInt8                             data[1];                    /* variable length array */
  210. };
  211. typedef struct ApplicationSpecificChunk    ApplicationSpecificChunk;
  212. typedef ApplicationSpecificChunk *        ApplicationSpecificChunkPtr;
  213.  
  214. struct Comment {
  215.     unsigned long                     timeStamp;
  216.     MarkerIdType                     marker;
  217.     unsigned short                     count;
  218.     char                             text[1];                    /* variable length array, Pascal string */
  219. };
  220. typedef struct Comment                    Comment;
  221.  
  222. struct CommentsChunk {
  223.     ID                                 ckID;
  224.     long                             ckSize;
  225.     unsigned short                     numComments;
  226.     Comment                         comments[1];                /* variable length array */
  227. };
  228. typedef struct CommentsChunk            CommentsChunk;
  229. typedef CommentsChunk *                    CommentsChunkPtr;
  230.  
  231. struct TextChunk {
  232.     ID                                 ckID;
  233.     long                             ckSize;
  234.     char                             text[1];                    /* variable length array, Pascal string */
  235. };
  236. typedef struct TextChunk                TextChunk;
  237. typedef TextChunk *                        TextChunkPtr;
  238.  
  239. #if PRAGMA_STRUCT_ALIGN
  240.     #pragma options align=reset
  241. #elif PRAGMA_STRUCT_PACKPUSH
  242.     #pragma pack(pop)
  243. #elif PRAGMA_STRUCT_PACK
  244.     #pragma pack()
  245. #endif
  246.  
  247. #ifdef PRAGMA_IMPORT_OFF
  248. #pragma import off
  249. #elif PRAGMA_IMPORT
  250. #pragma import reset
  251. #endif
  252.  
  253. #ifdef __cplusplus
  254. }
  255. #endif
  256.  
  257. #endif /* __AIFF__ */
  258.  
  259.